Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning but no error if compile_standalone but no functions found #956

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

jgabry
Copy link
Member

@jgabry jgabry commented Apr 22, 2024

closes #947

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

Continue with compilation if compile_stanalone=TRUE but no functions are found. Changes mysterious Rcpp error to an informative warning.

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Columbia University

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@jgabry jgabry requested a review from andrjohns April 22, 2024 22:23
@@ -979,6 +979,11 @@ expose_stan_functions <- function(function_env, global = FALSE, verbose = FALSE)
stop("Exporting standalone functions with external C++ is not available before CmdStan 2.32",
call. = FALSE)
}
if (!is.null(function_env$hpp_code) &&
!any(grepl("[[stan::function]]", function_env$hpp_code, fixed = TRUE))) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrjohns Is this an ok way to check whether there are any user defined functions?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks right to me

Copy link
Collaborator

@andrjohns andrjohns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I've also updated the model-expose-functions test to be entirely skipped on WSL - so that we don't have to keep adding skips to the individual tests (which was this failed before)

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.28%. Comparing base (1b45e70) to head (8505279).
Report is 25 commits behind head on master.

❗ Current head 8505279 differs from pull request most recent head 350fa68. Consider uploading reports for the commit 350fa68 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #956      +/-   ##
==========================================
- Coverage   88.33%   87.28%   -1.05%     
==========================================
  Files          12       13       +1     
  Lines        4553     4516      -37     
==========================================
- Hits         4022     3942      -80     
- Misses        531      574      +43     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrjohns andrjohns merged commit af80122 into master Apr 23, 2024
11 checks passed
@andrjohns andrjohns deleted the compile_standalone-warning branch April 23, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Standalone compilation poorly handles absent/empty functions block
3 participants